import request from "@/utils/request/http"
import { BASE_URL } from '../../common/js/constants';

// #region 独立请求方法
function uniRequest(url,method,data) {
  return new Promise((resolve, reject) => {
    uni.request({
      url: BASE_URL + url,
      data,
      method,
      header: {
        contentType: 'application/json;charset=UTF-8',
        requestTimeout: 100000,
        successCode: [200, 0, '200', '0'],
        statusName: 'code',
        messageName: 'message',
      },

      success: (res) => {
        resolve(res.data)
      },

      fail: (err) => {
        reject(err)
      }
    })
  })
}
// #endregion

export function login(data) {
  return request({
    url: '/user/login',
    method: "POST",
    data
  })
}

export function wxLogin(data) {
  return request({
    url: '/user/wxLogin',
    method: "POST",
    params:data
  })
}